package NIO;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

public class PathTest {
    public static void main(String[] args) throws IOException {
        Path source= Paths.get("file1.txt");
        System.out.println(source);
        Path file2= Paths.get("D:/代码2.txt/javaSE/file1.txt/../source.txt");
        System.out.println(file2);
        System.out.println(file2.normalize());

        Path target=Paths.get("target.txt");
        System.out.println(Files.exists(target));

        /*Path path=Paths.get("src/test/java/com.wxy");
        Files.createDirectory(path);*/

        /*Path path2=Paths.get("src/test/java/com.wxy/test");
        Files.createDirectories(path2);*/

        Path source1=Paths.get("source.txt");
        Path target1=Paths.get("target.txt");
        Files.copy(source1,target1, StandardCopyOption.REPLACE_EXISTING);

        /*Path from=Paths.get("file1.txt");
        Path to=Paths.get("src/test/java/file1.txt");
        Files.move(to,from,StandardCopyOption.ATOMIC_MOVE);*/


    }
}
